$(document).ready(function() {
  $('#addUserForm').bootstrapValidator({
      feedbackIcons: {
          valid: 'fa fa-check',

          validating: 'fa fa-sync-alt'
      },
      fields: {
          username: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 1,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[\u4E00-\u9FA5a-zA-Z0-9_-]+$/,
                      message: '用户名只能由汉字、字母、数字、横线和下划线组成'
                  }
              }
          },
          usercount: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '账号只能由字母、数字、横线和下划线组成'
                  }
              }
          },
          password: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '密码只能由字母、数字、横线和下划线组成'
                  },
                  identical: {
                      field: 'confirmPassword',
                      message: '两次输入的密码需保持一致'
                  }
              }
          },
          confirmPassword: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '密码只能由字母、数字、横线和下划线组成'
                  },
                  identical: {
                      field: 'password',
                      message: '两次输入的密码需保持一致'
                  }
              }
          },
          privilege: {
              validators: {
                  notEmpty: {}
              }
          }
      }
  });
  $('#editUserForm').bootstrapValidator({
      feedbackIcons: {
          valid: 'fa fa-check',

          validating: 'fa fa-sync-alt'
      },
      fields: {
          username: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 1,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[\u4E00-\u9FA5a-zA-Z0-9_-]+$/,
                      message: '用户名只能由汉字、字母、数字、横线和下划线组成'
                  }
              }
          },
          usercount: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '账号只能由字母、数字、横线和下划线组成'
                  }
              }
          },
          password: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '密码只能由字母、数字、横线和下划线组成'
                  },
                  identical: {
                      field: 'confirmPassword',
                      message: '两次输入的密码需保持一致'
                  }
              }
          },
          confirmPassword: {
              validators: {
                  notEmpty: {},
                  stringLength: {
                      min: 6,
                      max: 16,
                  },
                  regexp: {
                      regexp: /^[a-zA-Z0-9_-]+$/,
                      message: '密码只能由字母、数字、横线和下划线组成'
                  },
                  identical: {
                      field: 'password',
                      message: '两次输入的密码需保持一致'
                  }
              }
          },
          privilege: {
              validators: {
                  notEmpty: {}
              }
          }
      }
  });
});

/*点击修改按钮*/
function editUserInfo(e){
  $('#editUserModalCenter').modal();
}